package com.koron.operation.classes.shift.converter;

import com.alibaba.excel.converters.string.StringStringConverter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.koron.common.core.business.datadict.utils.DataDictTool;

import java.util.Map;

/**
 * @author jzp
 * @since 2022/4/1
 */
public class DutyConverter extends StringStringConverter {
    private final Map<String, String> duty;

    public DutyConverter(){
        this.duty = DataDictTool.getDataDictByCode("operationManagement", "operation_duty_type");
    }

    @Override
    public WriteCellData<String> convertToExcelData(String value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(duty.get(value));
    }

}
